{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

{{#if view.isOutOfSync}}
  <i class="glyphicon glyphicon-exclamation-sign out-of-sync-badge"></i>
{{/if}}

<div class="service-cell-wrapper repo-info">
  <div class="service-cell">
    <p class="version-column-display-name">
      {{#if view.content.isStandard}}
        <span>{{view.content.displayNameSimple}}</span>
      {{else}}
        <span>{{view.content.displayName}}</span>
      {{/if}}
    </p>

    <p class="version-column-repository-name">({{view.content.repositoryVersion}})</p>

    {{#if view.displayVersionTypeBlock}}
      <div class="version-column-display-type">
        {{#if view.content.isMaint}}
          <i class="icon-wrench"></i>&nbsp;{{t common.maint}}
        {{/if}}
        {{#if view.content.isPatch}}
          <i class="icon-bug"></i>&nbsp;{{t common.patch}}
        {{/if}}
        {{#if view.content.isService}}
          <i class="icon-umbrella"></i>&nbsp;{{t common.service}}
        {{/if}}
      </div>
    {{/if}}

    <p class="version-column-show-details">
      <a {{action openVersionBoxPopup target="view"}}>{{t admin.stackVersions.version.column.showDetails}}</a>
    </p>

    <div {{bindAttr class="view.stateElement.isInstalling:installing :align-center :state :repo-version-tooltip"}}>
      {{#if view.stateElement.isButton}}
        <button class="btn btn-primary"
          {{action runAction target="view"}}
          {{bindAttr disabled="view.stateElement.isDisabled"}}>
          {{view.stateElement.text}}
        </button>
      {{/if}}
      {{#if view.stateElement.isButtonGroup}}
        <div class="btn-group">
          <button class="btn btn-primary"
            {{action runAction target="view"}}
            {{bindAttr disabled="view.stateElement.isDisabled"}}>
            {{view.stateElement.text}}
          </button>
          <button class="btn btn-primary dropdown-toggle"
                  data-toggle="dropdown" {{bindAttr disabled="view.stateElement.isDisabled"}}>
            <span class="caret"></span>
          </button>
          <ul class="dropdown-menu">
            {{#each button in view.stateElement.buttons}}
              <li {{bindAttr class="button.isDisabled:disabled"}}>
                <a {{action runAction button.action target="view"}}>
                  {{button.text}}
                </a>
              </li>
            {{/each}}
          </ul>
        </div>
      {{/if}}
      {{#if view.stateElement.isLabel}}
        {{#if view.stateElement.iconClass}}
          <i {{bindAttr class="view.stateElement.iconClass" disabled="view.stateElement.isDisabled"}}></i>
        {{/if}}
        <span {{bindAttr class=":state-label view.stateElement.class"}}>{{view.stateElement.text}}</span>
      {{/if}}
      {{#if view.stateElement.isLink}}
        {{#if view.stateElement.iconClass}}
          <i {{bindAttr class="view.stateElement.iconClass" disabled="view.stateElement.isDisabled"}}></i>
        {{/if}}
        <a href="#" {{action runAction target="view"}}
          {{bindAttr disabled="view.stateElement.isDisabled"}}>{{view.stateElement.text}}</a>
        {{#if view.stateElement.isInstalling}}
          {{view App.ProgressBarView
          progressBinding="view.installProgress"
          statusBinding="view.PROGRESS_STATUS"
          }}
        {{/if}}
      {{/if}}
      {{#if view.stateElement.isSpinner}}
        {{view App.SpinnerView}}
      {{/if}}
    </div>
  </div>
</div>

<div class="service-section">
  {{#each service in view.services}}
    <div class="service-cell-wrapper">
      <div class="service-cell service-version-info">
        <span {{bindAttr class="service.isVersionInvisible:invisible service.isAvailable:available :label :service-label"}}>
          {{service.latestVersion}}
        </span>
        {{#if service.notUpgradable}}
          <i class="icon-info-sign not-upgradable" {{bindAttr data-original-title="service.notUpgradableTitle"}}></i>
        {{/if}}
      </div>
    </div>
  {{/each}}
  <div class="service-cell-wrapper">
    <div class="service-cell">
    </div>
  </div>
</div>
